#!/usr/bin/python
#-*- coding: UTF-8 -*-

from icq.traffic_statistics.models import *
from django.contrib import admin

#部门
class DepartmentAdmin(admin.ModelAdmin):
    fields=["department_name"]
    search_fields = ('department_name',)

#频道
class ChannelAdmin(admin.ModelAdmin):
    list_display = ('channel_name','cid','parent','owner_department')
    list_filter = ('owner_department','parent',)
    search_fields = ('channel_name','cid',)

#圈层
class GroupAdmin(admin.ModelAdmin):
    list_display = ('group_name','cyid','owner_department')
    list_filter = ('owner_department',)
    search_fields = ('group_name',)

#汇总数据
class TotalAdmin(admin.ModelAdmin):
    list_display = ('department_id','cid','cyid','aid','pv','uv','ip','dt')
    date_hierarchy = 'dt'
    list_filter = ('department_id','dt',)
    search_fields = ('cid','cyid','aid',)

#日志
#class LogAdmin(admin.ModelAdmin):
#    list_display = ('ip','dt','url')
#    #list_display = ('department_id','cid','cyid','aid','ip','dt','url')
#    list_filter = ('department_id','dt',)
#    #date_hierarchy = 'dt'
#    #ordering = ('-dt',)
#    search_fields = ('ip','aid',)

#未定义日志
#class UndefinedLogAdmin(admin.ModelAdmin):
#   list_display = ('cid','cyid','aid','ip','dt','url')
#   list_filter = ('dt',)
#   #date_hierarchy = 'dt'
#   #ordering = ('-dt',)
#   search_fields = ('ip','cid','cyid','aid',)

admin.site.register(Department,DepartmentAdmin)
admin.site.register(Channel,ChannelAdmin)
admin.site.register(Group,GroupAdmin)
admin.site.register(Total,TotalAdmin)
#admin.site.register(Log,LogAdmin)
#admin.site.register(UndefinedLog,UndefinedLogAdmin)